import { h } from 'vue';
import { Tag } from '@arco-design/web-vue';
import { BasicColumn } from '@/components/Table';

const noticeTypeMsg = ['公告', '会议', '其他'];
const receiveTypeMsg = ['全部', '部门'];

export const columns: BasicColumn[] = [
  {
    title: '标题',
    dataIndex: 'title',
  },
  {
    title: '类型',
    dataIndex: 'noticeType',
    render({ record }) {
      return h(
        Tag,
        {
          type: 'default',
        },
        {
          default: () => noticeTypeMsg[record.noticeType - 1],
        },
      );
    },
  },
  {
    title: '接收类型',
    dataIndex: 'receiveType',
    render({ record }) {
      return h(
        Tag,
        {
          type: 'default',
        },
        {
          default: () => receiveTypeMsg[record.noticeType - 1],
        },
      );
    },
  },
  {
    title: '发送者',
    dataIndex: 'sendName',
  },
  {
    title: '状态',
    dataIndex: 'noticeStatus',
    render({ record }) {
      return h(
        Tag,
        {
          type: record.noticeStatus === 1 ? 'success' : 'warning',
        },
        {
          default: () => (record.noticeStatus === 1 ? '已发' : '草稿'),
        },
      );
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createDate',
  },
];
